package com.stork.sms.fragment;



import android.annotation.SuppressLint;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.annotation.TargetApi;
import android.app.Fragment;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.ViewGroup;

/*import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;*/
import com.stork.sms.R;


@SuppressLint("NewApi")
public class MapView extends Fragment implements LocationListener {
	
	//GoogleMap googleMap;
	 Button Home,Logout;
	 double latitude;
	 double longitude;
	 LocationManager lm;	 

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		View mapView=inflater.inflate(R.layout.mapview, null);	
		
		return mapView;
	}
	public void onCreate(Bundle savedInstanceState)
	{
		
		super.onCreate(savedInstanceState);
		

	  }
	
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		lm = (LocationManager)getActivity().getSystemService(Context.LOCATION_SERVICE);

		   
		   lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);

		  /* googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
		    .getMap();

		   final LatLng CHENNAI = new LatLng(13.041279 , 80.235111);
		   

		   CameraUpdate cameraupdate=CameraUpdateFactory.newLatLngZoom(CHENNAI, 15);
		   googleMap.animateCamera(cameraupdate);
		  	  Marker melbourne = googleMap.addMarker(new MarkerOptions()
		  	                            .position(CHENNAI)
		  	                            .title("Stork Software Systems Pvt. Ltd.")
		  	                            
		  	                            .snippet("No.108, 3'rd Floor")
		  	                            .snippet("Rajalakshmi mahal")
		  	                            .snippet("Thiyagaraya Road")
		  	                            .snippet("Pondy Bazar, T.Nagar")
		  	                            .snippet("Chennai-600017"));
		super.onActivityCreated(savedInstanceState);
	}
	
public void onLocationChanged(Location location) {

	  googleMap.clear();

 MarkerOptions mp = new MarkerOptions();

 mp.position(new LatLng(location.getLatitude(), location.getLongitude()));

 mp.title("my position");
 

 googleMap.addMarker(mp);

 googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
  new LatLng(location.getLatitude(), location.getLongitude()), 16));*/

}

public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub

}

public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub

}

public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub

}
@Override
public void onLocationChanged(Location arg0) {
	// TODO Auto-generated method stub
	
}

}



